package fr.afcepf.iziticket.beans;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import fr.afcepf.iziticket.entities.Spectacle;
import fr.afcepf.iziticket.services.TopSpectacleService;


@ManagedBean(name="mbTopSpectacles")
@SessionScoped
public class TopSpectacleManagedBean {
	
	private TopSpectacleService service = TopSpectacleService.getService();
	
	private List<Spectacle> spectacles = new ArrayList<Spectacle>();
	
	public List<Spectacle> getSpectacles() {
		if(spectacles.size() == 0)
		{
			service.getSpectacles(spectacles);		
		}
		return this.spectacles;
	}
	public void setSpectacles(List<Spectacle> spectacles) {
		this.spectacles = spectacles;
	}
	public Spectacle getSpectacle1() {
		return this.spectacles.get(0);
	}
	public Spectacle getSpectacle2() {
		return this.spectacles.get(1);
	}
	public Spectacle getSpectacle3() {
		return this.spectacles.get(2);
	}
	public Spectacle getSpectacle4() {
		return this.spectacles.get(3);
	}

}
